home *** CD-ROM | disk | FTP | other *** search
/ Aminet 32 / Aminet 32 (1999)(Schatztruhe)[!][Aug 1999].iso / Aminet / dev / c / SUPRALib.lha / SUPRALib / Developer / Source.ORG / RelPens.c < prev   
C/C++ Source or Header  |  1999-05-17  |  1KB  |  44 lines

  1. /****** RelPens *****************************************************
  2. *
  3. *   NAME
  4. *       RelPens -- Release a list of pens obtained by ObtPens (V10)
  5. *       (gfx V39)
  6. *   SYNOPSIS
  7. *       RelPens(cm, PalTable, PensTable)
  8. *
  9. *       void (struct ColorMap *, ULONG *, ULONG *);
  10. *
  11. *   FUNCTION
  12. *       This function repeats calls to ReleasePen() in order to
  13. *       release all pens obtained by ObtPens().
  14. *
  15. *   INPUTS
  16. *       cm = colormap
  17. *       PalTable - the same PalTable called with ObtPens()
  18. *       PensTable - the same PensTable called with ObtPens()
  19. *
  20. *   NOTES
  21. *       Please DO NOT modify PalTable and PensTable between calling
  22. *       ObtPens() and RelPens(). This function uses the first long
  23. *       word from PalTable (describing number of entries and starting
  24. *       position), and all entries from PensTable (except those entries
  25. *       that are lower than a starting position).
  26. *       You MUST open graphics library (V39 or higher) before calling
  27. *       this function!
  28. *
  29. *   SEE ALSO
  30. *       ObtPens(), ReleasePen()
  31. *
  32. *********************************************************************/
  33.  
  34. #include <libraries/supra.h>
  35. #include <proto/graphics.h>
  36.  
  37. void RelPens(struct ColorMap *cm, ULONG *table, ULONG *pal)
  38. {
  39. UWORD i;
  40. UWORD num = table[0]>>16;
  41.  
  42.     for (i=(UWORD)*((UWORD *)table+1); i<num; i++) ReleasePen(cm, pal[i]);
  43. }
  44.